package fhq.hcmute.edu.vn.keyboard;
/**
 * 
 */

import java.awt.event.KeyEvent;
import java.io.Serializable;

/**
 * @author Hien Nguyen Sep 28, 2012
 */
public enum KeyCode_Telex implements Serializable {

	á(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_S),
	à(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_F),
	ả(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_R),
	ã(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_X),
	ạ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_J),
	â(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_A),
	ă(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_W),
	ấ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_A, KeyEvent.VK_S),
	ầ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_A, KeyEvent.VK_F),
	ẩ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_A, KeyEvent.VK_R),
	ẫ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_A, KeyEvent.VK_X),
	ậ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_A, KeyEvent.VK_J),
	ặ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_W, KeyEvent.VK_J),
	ắ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_W, KeyEvent.VK_S),
	ằ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_A, KeyEvent.VK_W, KeyEvent.VK_F),

	é(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_E, KeyEvent.VK_S),
	è(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_E, KeyEvent.VK_F),
	ẻ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_E, KeyEvent.VK_R),
	ẽ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_E, KeyEvent.VK_X),
	ẹ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_E, KeyEvent.VK_J),
	ê(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_E, KeyEvent.VK_E),
	ế(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_E, KeyEvent.VK_E, KeyEvent.VK_S),
	ề(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_E, KeyEvent.VK_E, KeyEvent.VK_F),
	ể(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_E, KeyEvent.VK_E, KeyEvent.VK_R),
	ễ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_E, KeyEvent.VK_E, KeyEvent.VK_X),
	ệ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_E, KeyEvent.VK_E, KeyEvent.VK_J),

	ý(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_Y, KeyEvent.VK_S),
	ỳ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_Y, KeyEvent.VK_F),
	ỵ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_Y, KeyEvent.VK_J),
	ỷ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_Y, KeyEvent.VK_R),
	ỹ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_Y, KeyEvent.VK_X),

	í(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_I, KeyEvent.VK_S),
	ì(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_I, KeyEvent.VK_F),
	ỉ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_I, KeyEvent.VK_R),
	ĩ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_I, KeyEvent.VK_X),
	ị(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_I, KeyEvent.VK_J),

	ó(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_S),
	ò(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_F),
	ỏ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_R),
	õ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_X),
	ọ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_J),
	ô(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_O),
	ơ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_W),
	ố(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_O, KeyEvent.VK_S),
	ồ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_O, KeyEvent.VK_F),
	ổ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_O, KeyEvent.VK_R),
	ỗ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_O, KeyEvent.VK_X),
	ộ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_O, KeyEvent.VK_J),
	ớ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_W, KeyEvent.VK_S),
	ờ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_W, KeyEvent.VK_F),
	ở(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_W, KeyEvent.VK_R),
	ỡ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_W, KeyEvent.VK_X),
	ợ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_O, KeyEvent.VK_W, KeyEvent.VK_J),

	ú(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_U, KeyEvent.VK_S),
	ù(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_U, KeyEvent.VK_F),
	ủ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_U, KeyEvent.VK_R),
	ũ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_U, KeyEvent.VK_X),
	ụ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_U, KeyEvent.VK_J),
	ư(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_U, KeyEvent.VK_W),
	ứ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_U, KeyEvent.VK_W, KeyEvent.VK_S),
	ừ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_U, KeyEvent.VK_W, KeyEvent.VK_F),
	ử(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_U, KeyEvent.VK_W, KeyEvent.VK_R),
	ữ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_U, KeyEvent.VK_W, KeyEvent.VK_X),
	ự(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_U, KeyEvent.VK_W, KeyEvent.VK_J),

	đ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_D, KeyEvent.VK_D),

	Á(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_A, KeyEvent.VK_S),
	À(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_A, KeyEvent.VK_F),
	Ả(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_A, KeyEvent.VK_R),
	Ã(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_A, KeyEvent.VK_X),
	Ạ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_A, KeyEvent.VK_J),
	Â(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_A, KeyEvent.VK_A),
	Ấ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_A, KeyEvent.VK_A,
			KeyEvent.VK_S),
	Ầ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_A, KeyEvent.VK_A,
			KeyEvent.VK_F),
	Ẩ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_A, KeyEvent.VK_A,
			KeyEvent.VK_R),
	Ẫ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_A, KeyEvent.VK_A,
			KeyEvent.VK_X),
	Ậ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_A, KeyEvent.VK_A,
			KeyEvent.VK_J),
	Ặ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_A, KeyEvent.VK_W,
			KeyEvent.VK_J),
	Ắ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_A, KeyEvent.VK_W,
			KeyEvent.VK_S),
	Ằ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_A, KeyEvent.VK_W,
			KeyEvent.VK_F),

	É(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_E, KeyEvent.VK_S),
	È(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_E, KeyEvent.VK_F),
	Ẻ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_E, KeyEvent.VK_R),
	Ẽ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_E, KeyEvent.VK_X),
	Ẹ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_E, KeyEvent.VK_J),
	Ê(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_E, KeyEvent.VK_E),
	Ế(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_E, KeyEvent.VK_E,
			KeyEvent.VK_S),
	Ề(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_E, KeyEvent.VK_E,
			KeyEvent.VK_F),
	Ể(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_E, KeyEvent.VK_E,
			KeyEvent.VK_R),
	Ễ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_E, KeyEvent.VK_E,
			KeyEvent.VK_X),
	Ệ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_E, KeyEvent.VK_E,
			KeyEvent.VK_J),

	Ý(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_Y, KeyEvent.VK_S),
	Ỳ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_Y, KeyEvent.VK_F),
	Ỵ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_Y, KeyEvent.VK_J),
	Ỷ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_Y, KeyEvent.VK_R),
	Ỹ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_Y, KeyEvent.VK_X),

	Í(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_I, KeyEvent.VK_S),
	Ì(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_I, KeyEvent.VK_F),
	Ỉ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_I, KeyEvent.VK_R),
	Ĩ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_I, KeyEvent.VK_X),
	Ị(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_I, KeyEvent.VK_J),

	Ó(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_S),
	Ò(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_F),
	Ỏ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_R),
	Õ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_X),
	Ọ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_J),
	Ô(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_O),
	Ơ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_W),
	Ố(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_O,
			KeyEvent.VK_S),
	Ồ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_O,
			KeyEvent.VK_F),
	Ổ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_O,
			KeyEvent.VK_R),
	Ỗ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_O,
			KeyEvent.VK_X),
	Ộ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_O,
			KeyEvent.VK_J),
	Ớ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_W,
			KeyEvent.VK_S),
	Ờ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_W,
			KeyEvent.VK_F),
	Ở(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_W,
			KeyEvent.VK_R),
	Ỡ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_W,
			KeyEvent.VK_X),
	Ợ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_O, KeyEvent.VK_W,
			KeyEvent.VK_J),

	Ú(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_U, KeyEvent.VK_S),
	Ù(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_U, KeyEvent.VK_F),
	Ủ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_U, KeyEvent.VK_R),
	Ũ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_U, KeyEvent.VK_X),
	Ụ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_U, KeyEvent.VK_J),
	Ư(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_U, KeyEvent.VK_W),
	Ứ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_U, KeyEvent.VK_W,
			KeyEvent.VK_S),
	Ừ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_U, KeyEvent.VK_W,
			KeyEvent.VK_F),
	Ử(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_U, KeyEvent.VK_W,
			KeyEvent.VK_R),
	Ữ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_U, KeyEvent.VK_W,
			KeyEvent.VK_X),
	Ự(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_SHIFT, KeyEvent.VK_U, KeyEvent.VK_W,
			KeyEvent.VK_J),

	Đ(KeyEvent.VK_BACK_SPACE, KeyEvent.VK_D, KeyEvent.VK_D),
	UNDEFINED(KeyEvent.VK_UNDEFINED);

	private int key2;
	private int key1;
	private int key3;
	private int key4;
	private int key5;
	private int keyCount = 0;

	public final int getKey5() {
		return key5;
	}

	public final void setKey5(int key5) {
		this.key5 = key5;
	}

	public final int getKey4() {
		return key4;
	}

	public final void setKey4(int key4) {
		this.key4 = key4;
	}

	public final int getKey2() {
		return key2;
	}

	public final void setKey2(int key2) {
		this.key2 = key2;
	}

	public final int getKey1() {
		return key1;
	}

	public final void setKey1(int key1) {
		this.key1 = key1;
	}

	public final int getKey3() {
		return key3;
	}

	public final void setKey3(int key3) {
		this.key3 = key3;
	}

	public final int getKeyCount() {
		return keyCount;
	}

	public final void setKeyCount(int keyCount) {
		this.keyCount = keyCount;
	}

	private KeyCode_Telex(int key1) {
		this.key1 = key1;
		keyCount = 1;
	}

	private KeyCode_Telex(int key1, int key2) {
		this.key1 = key1;
		this.key2 = key2;
		keyCount = 2;
	}

	private KeyCode_Telex(int key1, int key2, int key3) {
		this.key1 = key1;
		this.key2 = key2;
		this.key3 = key3;
		keyCount = 3;
	}

	private KeyCode_Telex(int key1, int key2, int key3, int key4) {
		this.key1 = key1;
		this.key2 = key2;
		this.key3 = key3;
		this.key4 = key4;
		keyCount = 4;
	}

	private KeyCode_Telex(int key1, int key2, int key3, int key4, int key5) {
		this.key1 = key1;
		this.key2 = key2;
		this.key3 = key3;
		this.key4 = key4;
		this.key5 = key5;
		keyCount = 5;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return name();
	}

	public static KeyCode_Telex fromString(char c) {
		String text = Character.toString(c);
		if (text != null) {
			for (KeyCode_Telex b : KeyCode_Telex.values()) {
				if (text.equals(b.name())) {
					return b;
				}
			}
		}
		return UNDEFINED;
	}

	public static KeyCode_Telex fromString(String text) {
		if (text != null) {
			for (KeyCode_Telex b : KeyCode_Telex.values()) {
				if (text.equals(b.name())) {
					return b;
				}
			}
		}
		return UNDEFINED;
	}
}
